<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../js/jQuery.js"></script>
    <script src="../js/jQuery.cookie.js"></script>
    <script src="../js/template-web.js"></script>
    <script src="../js/jQuery.cookie.js"></script>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <title>Document</title>
    <style>
        body{
            position: relative;
        }
      
        .ten {
            margin: 0 auto;
        }
        .cl{
            padding-bottom: 10px;
        }
        .table{
            width: 100%;
            position: absolute;
            left: 50%;
            margin-left: -25%;
            text-align: center;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="row">
            <div class=" col-xs-8 ten" >
                <p class="cl"></p>
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <td>学号</td>
                            <td>姓名</td>
                        </tr>
                    </thead>
                    <tbody id="tbody">

                    </tbody>
                </table>
            </div>
        </div>
    </div>


    <script type="text/html" id="table">
        {{each tab}}
        <tr>
            <td>{{$value.stu_id}}</td>
            <td>{{$value.stu_name}}</td>
        </tr>
        {{/each}}
    </script>
    <script>
        var b = $.cookie('index')
        console.log(b);
        $.ajax({
            type: 'post',
            url: "/teacher/statisticsClass",
            data: { homework_id: b },
            success: function (e) {
                var tbody = document.getElementById('tbody')
                var tem = template('table', { tab: e });
                tbody.innerHTML = tem;
            },
            error: function () {
                alert('请求失败')
            }
        })

    </script>
</body>

</html>